//
//  Auction_OfferPriceDone_View_WX.m
//  ZITHER
//
//  Created by weixin on 2019/5/31.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Auction_OfferPriceDone_View_WX.h"

@implementation Auction_OfferPriceDone_View_WX

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addToKeyWindow];
    }
    return self;
}

-(void)show{
    [super show];
    [self addSubview:self.backView];
}

-(BaseView *)backView{
    if (!_backView) {
        _backView = [[BaseView alloc]initWithFrame:CGRectMake(0, kScreenH -kScreenW/375.0*350, kScreenW, kScreenH-kScreenW/375.0*350)];
        _backView.backgroundColor =  HexColor(0xf5f5f5);
        
        [_backView setCornerRadiusWithRadius:15 isMasks:YES];
        [self addSubview:_backView];
        [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.height.mas_equalTo(kScreenW/375.0*350);
        }];
        [self setUI];
    }
    return _backView;
}

-(void)setUI{
    /**
     backView;
     donePic;
     specialSaleLab;
     PriceLab;
     enquiryCountLab;
     BusinessesCountLab;
     done;
     */
    /* MARK: ================= 上面灰色手表信息部分 =================*/
    
    [self.donePic mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self).offset(0);
        make.top.equalTo(self.backView).offset(40);
        make.height.width.mas_equalTo(60);
    }];
    
    
    [self.specialSaleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.donePic.mas_left).offset(7);
        make.top.equalTo(self.donePic.mas_bottom).offset(30);
    }];
    [self.PriceLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self).offset(20);
        make.centerY.equalTo(self.specialSaleLab).offset(0);
    }];
    
    [self.enquiryCountLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.PriceLab.mas_bottom).offset(22);
        make.centerX.equalTo(self).offset(0);
    }];

    [self.BusinessesCountLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self).offset(0);
        make.top.equalTo(self.enquiryCountLab.mas_bottom).offset(10);
    }];

    [self.done mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self).offset(0);
        make.top.equalTo(self.BusinessesCountLab.mas_bottom).offset(22);
        make.left.equalTo(self).offset(100);
        make.right.equalTo(self).offset(-100);
        make.height.mas_equalTo(40);
    }];
    
}
/**
 backView;
 donePic;
 specialSaleLab;
 PriceLab;
 enquiryCountLab;
 BusinessesCountLab;
 done;
 */
-(BaseImageV *)donePic{
    if (!_donePic) {
        _donePic= [BaseImageV initCustom:CGRectZero contentMode:2];
        _donePic.image = [UIImage imageNamed:@"位置图标"];
        _donePic.backgroundColor = [UIColor grayColor];
        [_donePic setCornerRadiusWithRadius:30 isMasks:YES];
        [self.backView addSubview:_donePic];
    }
    return _donePic;
}

-(BaseLab *)specialSaleLab{
    if (!_specialSaleLab) {
        _specialSaleLab = [BaseLab initCustomLab:@"出价" color:HexColor(0xff6f6f) font:[UIFont fontWithName:@"PingFang-SC-Bold" size: 20]];
        _specialSaleLab.backgroundColor = [UIColor clearColor];
        [self.backView addSubview:_specialSaleLab];
    }
    return _specialSaleLab;
}

-(BaseLab *)PriceLab{
    if (!_PriceLab) {
        _PriceLab = [BaseLab initCustomLab:@"¥531,111" color:HexColor(0xff6f6f) font:[UIFont fontWithName:@"PingFangSC-Semibold" size:20]];
        _PriceLab.backgroundColor = [UIColor clearColor];
        [self.backView addSubview:_PriceLab];
    }
    return _PriceLab;
}

-(BaseLab *)enquiryCountLab{
    if (!_enquiryCountLab) {
        _enquiryCountLab = [BaseLab initCustomLab:@"49人在出价" color:HexColor(0x999999) font:[UIFont fontWithName:@"PingFang-SC-Regular" size: 14]];
        _enquiryCountLab.backgroundColor = [UIColor clearColor];
        
        [self.backView addSubview:_enquiryCountLab];
    }
    return _enquiryCountLab;
}
-(BaseLab *)BusinessesCountLab{
    if (!_BusinessesCountLab) {
        _BusinessesCountLab = [BaseLab initCustomLab:@"商家联系过2个用户，如有意，会继续联系你" color:HexColor(0x000000) font:[UIFont fontWithName:@"PingFang-SC-Regular" size: 14]];
        _BusinessesCountLab.backgroundColor = [UIColor clearColor];
        [self.backView addSubview:_BusinessesCountLab];
    }
    return _BusinessesCountLab;
}
- (BaseBtn *)done{
    if (!_done) {
        _done = [BaseBtn initCustomBtnTitlestype:@[@"完成"] color:@[[UIColor whiteColor]]];
        _done.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15];
        _done.backgroundColor =  baseColorTheme;
        [_done setCornerRadiusWithRadius:6 isMasks:YES];
        [[_done addTag]subscribeNext:^(id  _Nullable x) {
            [self hide];
        }];
        [self.backView addSubview:_done];
    }
    return _done;
}

@end
